﻿using Dapper;
using System.Data;
using System.Threading.Tasks;

namespace lwzlz.Core.Repository
{
    /// <summary>
    /// 默认仓储接口实现局部类 Delete
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    public partial class Repository<TEntity>
    {
        public int Delete(object id, IDbTransaction transaction = null, int? commandTimeout = default(int?))
        {
            return dbconn.Delete<TEntity>(id, transaction, commandTimeout);
        }

        public int Delete(TEntity entity, IDbTransaction transaction = null, int? commandTimeout = default(int?))
        {
            return dbconn.Delete(entity, transaction, commandTimeout);
        }

        public Task<int> DeleteAsync(object id, IDbTransaction transaction = null, int? commandTimeout = default(int?))
        {
            return dbconn.DeleteAsync(id, transaction, commandTimeout);
        }

        public Task<int> DeleteAsync(TEntity entity, IDbTransaction transaction = null, int? commandTimeout = default(int?))
        {
            return dbconn.DeleteAsync(entity, transaction, commandTimeout);
        }

        public int DeleteList(object whereConditions, IDbTransaction transaction = null, int? commandTimeout = default(int?))
        {
            return dbconn.DeleteList<TEntity>(whereConditions, transaction, commandTimeout);
        }

        public int DeleteList(string whereConditions, object param = null, IDbTransaction transaction = null, int? commandTimeout = default(int?))
        {
            return dbconn.DeleteList<TEntity>(whereConditions, param, transaction, commandTimeout);
        }

        public Task<int> DeleteListAsync(object whereConditions, IDbTransaction transaction = null, int? commandTimeout = default(int?))
        {
            return dbconn.DeleteListAsync<TEntity>(whereConditions, transaction, commandTimeout);
        }

        public Task<int> DeleteListAsync(string whereConditions, object param = null, IDbTransaction transaction = null, int? commandTimeout = default(int?))
        {
            return dbconn.DeleteListAsync<TEntity>(whereConditions, param, transaction, commandTimeout);
        }
    }
}
